package handler;

import ui.EditorFrame;
import util.CommandUtil;

//运行cmm文件处理类
public class CmmRunHandler {
	
	public String run(EditorFrame editorFrame) {
		try {
			//获得项目目录的路径
			String projectPath = editorFrame.getCurrentProject().getAbsolutePath();
			//获得源文件的全路径
			String sourcePath = editorFrame.getCurrentFile().getFile().getAbsolutePath();
			//拼装命令
			String command = projectPath+File.separator+"exe\\cmm.exe " + sourcePath;
			Process p = CommandUtil.executeCommand(command);
			return CommandUtil.getRunString(p);
		} 
		catch (Exception e) {
			return e.getMessage();
		}
	}
	
}

